from daos import get_db_session
from models.dy_tags import DyTags


def query_dy_tags_s(data_param):
    filter_s = []

    if data_param.get('tag_name'):
        filter_s.append(DyTags.tag_name.contains(data_param.get('tag_name')))

    session = get_db_session()
    return session.query(DyTags) \
        .filter(*filter_s) \
        .order_by(DyTags.id.asc()) \
        .all()
